package com.johnny.cms.core.manager.trans;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.johnny.core.helper.RichHtmlHelper;
import com.johnny.core.hibernate.orm.IProperyFilter;
import com.johnny.core.hibernate.orm.Page;
import com.johnny.lang.KeepAll;
import com.johnny.nob.dao.NboMailListDao;
import com.johnny.nob.dao.NobContactDao;
import com.johnny.nob.dao.NobEnquiryDao;
import com.johnny.nob.domain.NboContact;
import com.johnny.nob.domain.NboEnquiry;
import com.johnny.nob.domain.NboMailList;

@Component
@KeepAll
@Transactional
public class NOBManager {

	@Autowired
	private NobContactDao nobContactDao;
	@Autowired
	private NobEnquiryDao nobEnquiryDao;
	@Autowired
	private NboMailListDao nboMailListDao;

	public void saveNobContact(NboContact contact) {
		RichHtmlHelper.safeObject(contact);
		nobContactDao.save(contact);

	}

	public void findNobContactByPage(Page<NboContact> page,
			List<IProperyFilter> properyFilters) {
		nobContactDao.findPage(page, properyFilters);

	}

	public void saveNobEnquiry(NboEnquiry entity) {
		RichHtmlHelper.safeObject(entity);
		nobEnquiryDao.save(entity);

	}

	public void findNobEnquiryByPage(Page<NboEnquiry> page,
			List<IProperyFilter> rules) {
		nobEnquiryDao.findPage(page, rules);

	}

	public List<NboContact> getAllNobContacts() {

		return nobContactDao.getAll();
	}

	public void findNobMailListByPage(Page<NboMailList> page,
			List<IProperyFilter> rules) {
		nboMailListDao.findPage(page, rules);

	}

	public void saveNboMailList(NboMailList nboMailList) {
		nboMailListDao.save(nboMailList);
	}

	public List<NboMailList> getAllNboMailList() {
		return nboMailListDao.getAll();
	}

}
